package com.xckj.teacher.ui.fragment

import com.blankj.utilcode.util.ClipboardUtils
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.ToastUtils
import com.google.gson.Gson
import com.luck.picture.lib.app.PictureAppMaster
import com.luck.picture.lib.config.PictureMimeType
import com.luck.picture.lib.entity.LocalMedia
import com.luck.picture.lib.utils.MediaUtils
import com.xckj.teacher.R
import com.xckj.teacher.bean.BaseBean
import com.xckj.teacher.bean.Student
import com.xckj.teacher.bean.UploadResponse
import com.xckj.teacher.databinding.DialogStudentBinding
import com.xckj.teacher.framework.BaseDialogFragment
import com.xckj.teacher.framework.net.RetrofitManager
import com.xckj.teacher.global.Constant
import com.xckj.teacher.presenter.ClassPresenter
import com.xckj.teacher.ui.App
import com.xckj.teacher.ui.activity.EditClassActivity
import com.xckj.teacher.ui.appViewModel
import com.xckj.teacher.util.ActivityMessenger
import com.xckj.teacher.util.get
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import java.io.File
import java.util.Objects


class StudentDialog(var stu: Student, var back: () -> Unit) :
    BaseDialogFragment<DialogStudentBinding>(1) {
    private val presenter: ClassPresenter by lazy { ClassPresenter(this) }

    override fun loadLayout(): Int {
        return R.layout.dialog_student
    }

    override fun initData() {
        dataBinding?.data = stu
        dataBinding?.click = ProxyClick()
    }

    inner class ProxyClick {
        fun copy() {
            ToastUtils.showShort("复制成功 ${stu.nickname} 账号：${stu.username}")
            ClipboardUtils.copyText(stu.username)
            dismiss()
        }

        fun reset() {
            presenter.gradeResetPass(stu.id.toString()) {
                ToastUtils.showShort("重置成功 ${stu.nickname} 密码：${it}")
                dismiss()
            }
        }

        fun cancel() {
            dismiss()
        }

    }


}